package com.vitaf.cash.app.ui.dialog

import android.content.Context
import android.view.LayoutInflater
import android.view.View
import com.vitaf.cash.app.R
import com.vitaf.cash.app.common.VitafComDlog
import com.vitaf.cash.app.databinding.VitafDlogStatusDetailsWalletOnlyOneBinding
import com.vitaf.cash.app.event.VitafEventPointType

/**
 * GombeCredit
 * @Author wwdeng
 * @CreateTime: 2024/11/21 13:45
 * @Annotation：法语区 - 订单详情只有一个账户提示
 */
class VitafStatusDetailsWalletOnlyOneDlog: VitafComDlog {
    private lateinit var binding: VitafDlogStatusDetailsWalletOnlyOneBinding
    private var mCallback: IDialogCallback? = null

    override val pageName: String = "Status_Details_Wallet_Only_One_Tips"

    constructor(context: Context) : super(context) {}
    constructor(context: Context, callback: IDialogCallback?) : super(context) {
        mCallback = callback
    }

    constructor(context: Context, remark: String,callback: IDialogCallback?) : super(context) {
        mCallback = callback
        pageRemark = remark
    }

    /**
     * 设置点击回调
     */
    fun setOnClick(callback: IDialogCallback){
        this.mCallback = callback
    }

    override fun createVitafContentView(): View {
        binding = VitafDlogStatusDetailsWalletOnlyOneBinding.inflate(LayoutInflater.from(context))
        return binding.root
    }

    override fun initializeVitafViews() {
    }

    override fun setupVitafEventListeners() {
        setOnClickListener(binding.btnWalletAdd) //继续添加
        setOnClickListener(binding.imageClose)//关闭
    }

    override fun loadVitafData() {
    }

    override fun onVitafEventViewClick(v: View?) {
        dismiss()
        when(v?.id){
            R.id.btnWalletAdd -> {
                addEventPointRequestAction(VitafEventPointType.GOMBECREDIT_TRACK_CLICK.USER_WALLET_ORDER_DETAILS_ONLYONE_TIPS_CONFIRM,pageRemark)
            }
        }
        if(mCallback != null){
            mCallback?.onClick(v)
        }
    }

    interface IDialogCallback {
        //按钮点击
        fun onClick(view: View?)
    }
}